import { NextResponse } from 'next/server';
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

export async function POST() {
  try {
    // 首先删除所有分数记录
    await prisma.score.deleteMany({});
    
    // 然后删除所有玩家记录
    await prisma.player.deleteMany({});
    
    return NextResponse.json({ 
      success: true, 
      message: '所有数据已成功删除' 
    });
  } catch (error) {
    console.error('Reset data error:', error);
    return NextResponse.json(
      { success: false, error: '删除数据失败' },
      { status: 500 }
    );
  }
} 